aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/invoice
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-06 09:32:53 -0700
committerAdam Soltys <[email protected]>2024-09-17 09:18:36 -0700
commit1b7cc6d64fb2ee3340a18d0924c4b64afabbc1e1 (patch)
tree4498405ef5555a6680b36e9628806f497ec0f561 /src/routes/(app)/[username]/invoice
parentc5ef18aec5de023732eb6b86f768f206462fea93 (diff)
downloadcoinos-ui-1b7cc6d64fb2ee3340a18d0924c4b64afabbc1e1.tar.gz
coinos-ui-1b7cc6d64fb2ee3340a18d0924c4b64afabbc1e1.zip
per account payment pages
Diffstat (limited to 'src/routes/(app)/[username]/invoice')
-rw-r--r--src/routes/(app)/[username]/invoice/[id]/+page.svelte89
1 files changed, 35 insertions, 54 deletions
diff --git a/src/routes/(app)/[username]/invoice/[id]/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/+page.svelte
index 28bfe27b..24e75fa5 100644
--- a/src/routes/(app)/[username]/invoice/[id]/+page.svelte
+++ b/src/routes/(app)/[username]/invoice/[id]/+page.svelte
@@ -28,7 +28,6 @@
export let data;
- let ndef;
let showOptions;
let reading = async ({ message, serialNumber }) => {
@@ -41,6 +40,7 @@
$: refresh(data);
let { invoice, id, subject, user, src } = data;
let {
+ account,
amount,
hash,
type,
@@ -56,6 +56,7 @@
let refresh = async (data) => {
({ invoice, id, user, src } = data);
({
+ account,
amount,
hash,
type,
@@ -66,21 +67,6 @@
} = invoice);
tipPercent = (tip / amount) * 100;
-
- // if (browser && window.NDEFReader) {
- // try {
- // ndef = new NDEFReader();
- // await ndef.scan();
- //
- // ndef.removeEventListener('readingerror', readingerror);
- // ndef.removeEventListener('reading', reading);
- //
- // ndef.addEventListener('readingerror', readingerror);
- // ndef.addEventListener('reading', reading);
- // } catch (e) {
- // console.log(e);
- // }
- // }
};
$: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2));
@@ -100,13 +86,6 @@
}
});
- onDestroy(() => {
- if (ndef) {
- ndef.removeEventListener("readingerror", readingerror);
- ndef.removeEventListener("reading", reading);
- }
- });
-
$: link = [types.bitcoin, types.liquid].includes(type)
? text
: `lightning:${text}`;
@@ -257,39 +236,41 @@
</div>
</div>
- <div class="flex justify-around text-secondary">
- <button
- class="hover:bg-primary my-auto flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
- class:bg-primary={type === types.bitcoin}
- class:text-black={type === types.bitcoin}
- on:click={() => setType(types.bitcoin)}
- >
- <img src="/images/bitcoin.svg" class="w-8" alt="Bitcoin" />
- <div class="my-auto text-lg">Bitcoin</div>
- </button>
+ {#if !account}
+ <div class="flex justify-around text-secondary">
+ <button
+ class="hover:bg-primary my-auto flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
+ class:bg-primary={type === types.bitcoin}
+ class:text-black={type === types.bitcoin}
+ on:click={() => setType(types.bitcoin)}
+ >
+ <img src="/images/bitcoin.svg" class="w-8" alt="Bitcoin" />
+ <div class="my-auto text-lg">Bitcoin</div>
+ </button>
- <button
- class="hover:bg-primary my-auto flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
- class:bg-primary={type === types.liquid}
- class:text-black={type === types.liquid}
- on:click={() => setType(types.liquid)}
- >
- <img src="/images/liquid.svg" class="w-8" alt="Liquid" />
- <div class="my-auto text-lg">Liquid</div>
- </button>
+ <button
+ class="hover:bg-primary my-auto flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
+ class:bg-primary={type === types.liquid}
+ class:text-black={type === types.liquid}
+ on:click={() => setType(types.liquid)}
+ >
+ <img src="/images/liquid.svg" class="w-8" alt="Liquid" />
+ <div class="my-auto text-lg">Liquid</div>
+ </button>
- <button
- class="hover:bg-primary flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
- class:bg-primary={type === types.lightning}
- class:text-black={type === types.lightning}
- on:click={() => setType(types.lightning)}
- >
- <div class="bg-white rounded-full w-8 h-8 text-center flex">
- <div class="m-auto">⚡️</div>
- </div>
- <div class="my-auto text-lg">Lightning</div>
- </button>
- </div>
+ <button
+ class="hover:bg-primary flex gap-1 sm:gap-2 py-3 px-2 sm:px-5 w-full justify-center"
+ class:bg-primary={type === types.lightning}
+ class:text-black={type === types.lightning}
+ on:click={() => setType(types.lightning)}
+ >
+ <div class="bg-white rounded-full w-8 h-8 text-center flex">
+ <div class="m-auto">⚡️</div>
+ </div>
+ <div class="my-auto text-lg">Lightning</div>
+ </button>
+ </div>
+ {/if}
{#if type === types.liquid}
<div class="flex justify-center">